#ifndef DEPARTMENTVIEW_H
#define DEPARTMENTVIEW_H

#include <QWidget>
#include <QTableWidget>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QComboBox>
#include <QMessageBox>
#include <QInputDialog>
#include "adminmanager.h"
class AdminManager;

class DepartmentView : public QWidget
{
    Q_OBJECT

public:
    explicit DepartmentView(QWidget *parent = nullptr);
    ~DepartmentView();

    void setAdminManager(AdminManager *manager);
    void refreshDepartmentList();
    void refreshEmployeeList(int deptId);

signals:
    void backToMain();

private slots:
    void onAddDepartmentButtonClicked();
    void onDeleteDepartmentButtonClicked();
    void onDepartmentTableItemClicked(int row, int column);
    void onBackButtonClicked();

private:
    AdminManager *m_adminManager;
    int m_currentDeptId; // 当前选中的部门ID

    // UI组件
    QTableWidget *m_departmentTable; // 部门表格
    QTableWidget *m_employeeTable;   // 员工表格
    QPushButton *m_addDepartmentButton;  // 添加部门按钮
    QPushButton *m_deleteDepartmentButton; // 删除部门按钮
    QPushButton *m_backButton;  // 返回按钮
    QLabel *m_departmentLabel;  // 部门列表标签
    QLabel *m_employeeLabel;    // 部门成员标签
    QLabel *m_deptNameLabel;    // 部门名称标签
    QLineEdit *m_deptNameEdit;  // 部门名称输入框
    QLabel *m_managerIdLabel;   // 经理ID标签
    QLineEdit *m_managerIdEdit; // 经理ID输入框

     AdminManager *adminManager;
};

#endif // DEPARTMENTVIEW_H
